import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '文件名',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '所在文件夹，为0则为一级目录下',
    align: "center",
    dataIndex: 'folderId'
  },
  {
    title: '文件大小',
    align: "center",
    dataIndex: 'size'
  },
  {
    title: '文件类型',
    align: "center",
    dataIndex: 'type'
  },
  {
    title: '文件路径',
    align: "center",
    dataIndex: 'path'
  },
  {
    title: '备注',
    align: "center",
    dataIndex: 'remark'
  },
  {
    title: '创建用户',
    align: "center",
    dataIndex: 'userId'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '文件名',
    field: 'name',
    component: 'Input',
  },
  {
    label: '所在文件夹，为0则为一级目录下',
    field: 'folderId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入所在文件夹，为0则为一级目录下!'},
             ];
    },
  },
  {
    label: '文件大小',
    field: 'size',
    component: 'InputNumber',
  },
  {
    label: '文件类型',
    field: 'type',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入文件类型!'},
             ];
    },
  },
  {
    label: '文件路径',
    field: 'path',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '创建用户',
    field: 'userId',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
